package com.zzptc.sky.baidudemo.base;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/5/26.
 */

public abstract class BaseFragmentsForSOS extends Fragment {
    private View view;
    private Unbinder unbinder;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(getFragmentXml(),container,false);
        unbinder = ButterKnife.bind(this,view);
        initView();
        initData();
        return view;
    }

    public abstract  int getFragmentXml();

    public abstract void initView();
    public abstract void initData();

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (unbinder != null){
            unbinder.unbind();
        }
    }

    public View getThisView(){
        return view;
    }
}
